package com.bj58.ecdata.mailreport.service.impl;

import java.util.List;

import com.bj58.ecdata.mailreport.db.CommonDao;
import com.bj58.ecdata.mailreport.db.DBConfig;
import com.bj58.ecdata.mailreport.model.IETableSearch;
import com.bj58.ecdata.mailreport.service.AbstractBaseService;

public class IETableSearchService extends AbstractBaseService<IETableSearch> {
	private CommonDao comDao = new CommonDao();
	
	public List<IETableSearch> getListByCon(String condition)
			throws Exception {
		String sql = "select * from ie_tablesearch where " + condition  + " order by id ";
		return comDao.getAllColsByVo(sql, IETableSearch.class, DBConfig.db_manage.getIntType());
	}

	public IETableSearch getById(int id) throws Exception {
		String sql = "select * from ie_tablesearch where id = " + id;
		return comDao.getAllColsByVo(sql, IETableSearch.class, DBConfig.db_manage.getIntType()).get(0);
	}

	public boolean updateVo(IETableSearch vo) throws Exception {
		int res =  comDao.updateByVo("ie_tablesearch", "id=" + vo.getId(), IETableSearch.class, vo, DBConfig.db_manage.getIntType());
		return res==0?false:true;
	}

	public boolean saveList(List<IETableSearch> tableSearchList)
			throws Exception {
		return comDao.insertVoList("ie_tablesearch", IETableSearch.class, tableSearchList, DBConfig.db_manage.getIntType());
	}

	public boolean deleteByCons(String condition) throws Exception {
		return comDao.deleteData("ie_tablesearch", condition,DBConfig.db_manage.getIntType());
	}

}
